package com.xmkj.bearbiz.my.adapter;

import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;

import com.common.bean.FriendCicleBean;
import com.common.widget.imageview.image.ImageLoaderUtils;
import com.xmkj.bearbiz.R;

import java.util.List;

/**
 * Created by Administrator on 2017/12/20.
 */

public class SharePicAdapter extends RecyclerView.Adapter<SharePicAdapter.ViewHolder> {
    public SharePicAdapter(List<FriendCicleBean.ListBean.PictureBean> datas, Context context) {
        this.datas = datas;
        this.context = context;
    }

    private List<FriendCicleBean.ListBean.PictureBean> datas;
    private Context context;

    @Override
    public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        View view = View.inflate(context, R.layout.pic, null);
        return new ViewHolder(view);
    }

    @Override
    public void onBindViewHolder(ViewHolder holder, int position) {
        ImageLoaderUtils.display(holder.ivImg,datas.get(position).pic);
    }

    @Override
    public int getItemCount() {
        return datas == null ? 0 : datas.size();
    }

    @Override
    public long getItemId(int position) {
        return position;
    }
    class ViewHolder extends RecyclerView.ViewHolder {
        ImageView ivImg;

        public ViewHolder(View itemView) {
            super(itemView);
            ivImg = (ImageView) itemView.findViewById(R.id.iv_pic);
        }
    }
}
